cmake_minimum_required(VERSION 3.20)

project(testCpp)

set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,Clang,GNU>")
set(msvc_cxx "$<COMPILE_LANG_AND_ID:CXX,MSVC>")

add_executable(test main.cpp)
# 添加编译选项-警告
target_compile_options(test PRIVATE 
    # 多个用分号隔开 
    "$<${gcc_like_cxx}:-Wall;-Wunused;-Wextra;-Wshadow>" 
    "$<${msvc_cxx}:-W3>"
)
